package com.ubs.training.server.dao.model;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

import javax.persistence.*;


/**
 * Created with IntelliJ IDEA.
 * User: xubuntu
 * Date: 8/21/12
 * Time: 3:28 AM
 * To change this template use File | Settings | File Templates.
 */
@GenericGenerator(name = "CMSTR_SEQ", strategy = "sequence",
        parameters = {@Parameter(name="sequence", value="cmstr_seq")})
@Entity(name= "ubs_contact")
public class UBSContact {
    @GeneratedValue(generator = "CMSTR_SEQ")
    @Id
    private int id;
    @ManyToOne
    @JoinColumn(name = "emp", referencedColumnName = "id")
    private Employee employee;
    @Column(name="emp", insertable = false, updatable = false)
    private int emp;
    private int status;
    @ManyToOne
    @JoinColumn(name="contact_type", referencedColumnName = "id")
    private ContactType contactType;
    @Column(name="contact_type", insertable = false, updatable = false)
    private int contact_type;
    private int client_id;

    public Employee getEmployee() {
        return employee;
    }

    public void setEmployee(Employee employee) {
        this.employee = employee;
    }

    public ContactType getContactType() {
        return contactType;
    }

    public void setContactType(ContactType contactType) {
        this.contactType = contactType;
    }
    public int getClient_id() {
        return client_id;
    }

    public void setClient_id(int client_id) {
        this.client_id = client_id;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getEmp() {
        return emp;
    }

    public void setEmp(int emp) {
        this.emp = emp;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public int getContact_type() {
        return contact_type;
    }

    public void setContact_type(int contact_type) {
        this.contact_type = contact_type;
    }

    @Override
    public String toString() {
        return "UBSContact{" +
                "id=" + id +
                ", employee=" + employee +
                ", emp=" + emp +
                ", status=" + status +
                ", contactType=" + contactType +
                ", contact_type=" + contact_type +
                ", client_id=" + client_id +
                '}';
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof UBSContact)) return false;

        UBSContact that = (UBSContact) o;

        if (client_id != that.client_id) return false;
        if (contact_type != that.contact_type) return false;
        if (emp != that.emp) return false;
        if (id != that.id) return false;
        if (status != that.status) return false;
        if (contactType != null ? !contactType.equals(that.contactType) : that.contactType != null) return false;
        if (employee != null ? !employee.equals(that.employee) : that.employee != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (employee != null ? employee.hashCode() : 0);
        result = 31 * result + emp;
        result = 31 * result + status;
        result = 31 * result + (contactType != null ? contactType.hashCode() : 0);
        result = 31 * result + contact_type;
        result = 31 * result + client_id;
        return result;
    }
}
